// import res from "@/library/userLogin.js"

const User = {
	namespaced: true,
	state: () => ({
		userInfo: {},
		router:{}
	}),
	mutations: {
		setUserInfo(state, userInfo) {
			state.userInfo = userInfo
		},
		setLoginOut(state) {
			state.userInfo = null
		},
		setRouter(state, data) {
			state.router = data
		},
	},
	actions: {
		setAsyncUserInfo(context, userInfo) {
			context.commit('setUserInfo', userInfo)
		},
		setAsyncUserRouter(context, data) {
			context.commit('setRouter', data)
			return Promise.resolve('success')
		},
		setAsyncLoginOut(context) {
			localStorage.removeItem('userInfo')
			context.commit('setLoginOut')
		}
	},
	getters: {}
}

export default User
